package com.wangjiyuan.giftshuo.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.wangjiyuan.giftshuo.bean.home.preset.ChannelsBean;

import java.util.List;

/**
 * Created by wjy on 2016/11/17.
 */

public class TabPagerAdapter extends FragmentPagerAdapter {
    private List<Fragment> fragments;
    private List<ChannelsBean> titles;

    public TabPagerAdapter(FragmentManager fm, List<Fragment> fragments, List<ChannelsBean> titles) {
        super(fm);
        this.fragments = fragments;
        this.titles = titles;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles.get(position).getName();
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

}
